package Threading;

public class Demo2 {
    // 使用匿名内部类, 来创建 Thread 子类.
    public static void main(String[] args) {
        Thread thread=new Thread(){
            @Override
            public void run() {
                for(int i=0;i<1000;i++){
                    System.out.println("=============Thread=============");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        };
        thread.start();

        for(int i=0;i<1000;i++){
            System.out.println("main");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}
